﻿

using IotContract.Models.Process;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IotContract.Models.Jobs.F29;
/// <summary>
/// 堆垛机入库任务
/// </summary>
[ProtoContract]
public class F29EnterJob: ProcessBaseData
{
    /// <summary>
    /// 设备编号
    /// </summary>
    [ProtoMember(1)]
    public string EquipNum { get; set; }

   
    /// <summary>
    /// 取货站台号
    /// </summary>
    [ProtoMember(2)]
    public int FromTagNumber { get; set; }
    /// <summary>
    /// 使用的叉  1:左叉  2:右叉  3:双叉
    /// </summary>
    [ProtoMember(3)]
    public int UsePoke { get; set; }
    /// <summary>
    /// 取货列
    /// </summary>
    [ProtoMember(4)]
    public int FromX { get; set; }
    /// <summary>
    /// 取货行
    /// </summary>
    [ProtoMember(5)]
    public int FromY { get; set; }
    /// <summary>
    /// 取货段
    /// </summary>
    [ProtoMember(6)]
    public int FromZ { get; set; }
    /// <summary>
    /// 去向列
    /// </summary>
    [ProtoMember(7)]
    public int ToX { get; set; }
    /// <summary>
    /// 去向行
    /// </summary>
    [ProtoMember(8)]
    public int ToY { get; set; }
    /// <summary>
    /// 去向段
    /// </summary>
    [ProtoMember(9)]
    public int ToZ { get; set; }
    /// <summary>
    /// 托盘
    /// </summary>
    [ProtoMember(10)]
    public string Tray { get; set; }
    /// <summary>
    /// 托盘2
    /// </summary>
    [ProtoMember(11)]
    public string Tray2 { get; set; }
    /// <summary>
    /// 状态 0 未启动 1 已启动 2 启动完成写入 3 确认完成
    /// </summary>
    [ProtoMember(12)]
    public int Status { get; set; }

   
    /// <summary>
    /// 取货站台2（右叉)
    /// </summary>
    [ProtoMember(13)]
    public int FromTagNumber2 { get; set; }
    /// <summary>
    /// 右叉取货列
    /// </summary>
    [ProtoMember(14)]
    public int FromX2 { get; set; }
    /// <summary>
    /// 右叉取货行
    /// </summary>
    [ProtoMember(15)]
    public int FromY2 { get; set; }
    /// <summary>
    /// 右叉取货段
    /// </summary>
    [ProtoMember(16)]
    public int FromZ2 { get; set; }
    /// <summary>
    /// 右叉去向列
    /// </summary>
    [ProtoMember(17)]
    public int ToX2 { get; set; }
    /// <summary>
    /// 右叉去向行
    /// </summary>
    [ProtoMember(18)]
    public int ToY2 { get; set; }
    /// <summary>
    /// 右叉去向段
    /// </summary>
    [ProtoMember(19)]
    public int ToZ2{ get; set; }
    /// <summary>
    /// 右叉托盘
    /// </summary>
    [ProtoMember(20)]
    public string RightTray { get; set; }
    /// <summary>
    /// 右叉托盘2
    /// </summary>
    [ProtoMember(21)]
    public string RightTray2 { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [ProtoMember(22)]
    public DateTime? CreateTime { get; set; } 

    
    /// <summary>
    /// 启动时间
    /// </summary>
    [ProtoMember(23)]
    public DateTime? RunTime { get; set; } 
   
    /// <summary>
    /// 错误信息
    /// </summary>

    [ProtoMember(24)]
    public string ErrorMsg { get; set; }
    /// <summary>
    /// 任务ID
    /// </summary>
    [ProtoMember(25)]
    public string JobID { get; set; }
    /// <summary>
    /// 任务ID2
    /// </summary>
    [ProtoMember(26)]
    public string JobID2 { get; set; } = string.Empty;
    /// <summary>
    /// 充放电关联id
    /// </summary>
    [ProtoMember(27)]
    public string FmtKey { get; set; }
    

    /// <summary>
    /// 获取Key
    /// </summary>
    /// <returns></returns>
    public string GetKey()
    {
        return $"{JobID}-{JobID2 ?? ""}";
    }
    public override string ToString()
    {
        return $"Enter JobID {JobID},EquipNumber {EquipNum},UsePoke {UsePoke},From {FromX}-{FromY}-{FromZ} To {ToX}-{ToY}-{ToZ} Tray {Tray}";
    }
}
